<div class="layui-card">

    <div class="layui-card-body">

        <div class="layui-row">
            <div class="{% if form['area'] == 'large' %}layui-col-md6 layui-col-md-offset3 {% else %} layui-col-md12 {% endif %}">
                <form id="form" class="layui-form " action="{{ action|default('') }}">

                    {% if id %}
                        <input type="hidden" name="id" value="{{ id }}">
                    {% endif %}

                    {% if controls %}
                        {% for control in controls %}
                            {{ control.render()|raw }}
                        {% endfor %}
                    {% endif %}

                    {% if btn %}
                        <div class="layui-form-item">
                            {% if id %}
                                <div class="layui-input-block">
                                    <input type="checkbox" lay-filter="stay-on-the-page"
                                           title="{{ __('general.submit_after_stay') }}">
                                </div>
                            {% endif %}
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-normal layui-btn-sm" lay-submit
                                        lay-filter="form-submit">
                                    {{ __('btn.submit') }}
                                </button>
                                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm" id="form-reset">
                                    {{ __('btn.reset') }}
                                </button>
                            </div>
                        </div>
                    {% endif %}
                </form>
            </div>
        </div>
    </div>
</div>

{% autoescape false %}
    <script id="thumbnail" type="text/html">
        <li class="file-item thumbnail">
            <a href="javascript:;">
                <img data-path="<% d.url %>"
                     data-original="<%  d.url %>"
                     src="<%  d.url %>">

                <div class="file-panel">
                    <i class="iconfont icon-tailor cropper"
                       data-input-id="c-upload_thumb_water_pic"></i>
                    <i class="iconfont icon-trash remove-picture"></i>
                </div>
            </a>
        </li>
    </script>
{% endautoescape %}


{% if load_editor %}
    <script src="__plugins__/tinymce/tinymce.min.js?v=1000"></script>
{% endif %}

<script type="text/javascript">

    {% if load_editor %}
    const editor_config = JSON.parse('{{ see_config('editor').tinymce|json_encode }}')
    {% endif %}

    layui.use(['page'], function () {
        let page = layui.page
        let config = {}
        if (typeof editor_config === 'object') {
            config['editor'] = editor_config
        }
        page.form(config)
    })
</script>


